package com.git_taoxian.test7;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;

public class Test {
    public static void main(String[] args) {
        Properties pro = new Properties();//创建Properties对象
        pro.setProperty("brand", "Iphone11Pro Max");
        pro.setProperty("capacity", "256G");
        pro.setProperty("price", "10899");
        FileWriter fw = null;
        try {
//        定义一个缓冲字节输出流
            fw = new FileWriter("homework/iphone.properties");
            pro.store(fw, "信息");
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fw.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
